package com.test.controller;


import com.test.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

// 类加载 解决跨域问题 比如你端口是7000想访问8080
@CrossOrigin
@RequestMapping("/index")
@RestController
@Slf4j
public class CommonController {
    @GetMapping("/hello")
    public Result hello(String name){
        return Result.success(name);
    }
        @PostMapping("/isnull")
    public Result post(@RequestBody Obj obj){
        return Result.success(obj.getName() == null ? "null" : obj.getName().isEmpty());
    }

    @PostMapping("/test")
    public Result test(@RequestBody Obj obj){
        return Result.success(obj);
    }

    @PutMapping("/put")
    public Result put(@RequestBody Obj obj){
        return Result.success(obj);
    }

    @DeleteMapping("/delete")
    public Result delete(@RequestBody List<Integer> ids){
        return Result.success(ids);
    }









}
